<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of MY_Model
 *
 * @author QuangBV
 */
class MY_Model extends CI_Model {

    //put your code here
    protected $table_name = NULL;

    function __construct() {
        parent::__construct();
    }

    function get_fields() {
        return $this->db->list_fields($this->table_name);
    }

    public function get($wheres) {
        $this->db->where($wheres);
        $record = $this->db->get_record($this->table_name);
        return $record;
    }

    function get_list() {
        $where = array("delete_time" => NULL);
        $this->db->where($where);
        $query = $this->db->get($this->table_name);
        if ($query->num_rows() > 0) {
            return $query->result_array();
        } else {
            return NULL;
        }
    }

}

?>
